﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace Bitcoin.Diagnostics
{
    public class DebugLog : ILog
    {
        string _typeName;

        public DebugLog(Type type)
        {
            _typeName = type.FullName;
            IsDebugEnabled = true;
            IsInfoEnabled = true;
        }

        public void DebugFormat(string format, params object[] args)
        {
            Debug.WriteLine("DEBUG(" + _typeName + "): " + format, args);
        }

        public void Error(string message)
        {
            Debug.WriteLine("ERROR(" + _typeName + "): " + message);
        }

        public void Error(string message, Exception e)
        {
            Debug.WriteLine("ERROR(" + _typeName + "): " + message + "; " + e.ToString());
        }

        public void ErrorFormat(string format, params object[] args)
        {
            Debug.WriteLine("ERROR(" + _typeName + "): " + format, args);
        }

        public void ErrorFormat(string format, Exception e, params object[] args)
        {
            Debug.WriteLine("ERROR(" + _typeName + "): " + format + "; " + e.ToString(), args);
        }

        public void Info(string message)
        {
            Debug.WriteLine("INFO(" + _typeName + "): " + message);
        }

        public void InfoFormat(string format, params object[] args)
        {
            Debug.WriteLine("INFO(" + _typeName + "): " + format, args);
        }

        public bool IsDebugEnabled
        {
            get;
            set;
        }

        public bool IsInfoEnabled
        {
            get;
            set;
        }

        public void Warn(string message)
        {
            Debug.WriteLine("WARNING(" + _typeName + "): " + message);
        }

        public void Warn(string message, Exception e)
        {
            Debug.WriteLine("WARNING(" + _typeName + "): " + message + "; " + e.ToString());
        }

        public void WarnFormat(string format, params object[] args)
        {
            Debug.WriteLine("WARNING(" + _typeName + "): " + format, args);
        }

    }
}
